package com.example.shkjdemo.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.shkjdemo.R
import com.example.shkjdemo.bean.HorizonalBean

class HorizonalTestAdapter : RecyclerView.Adapter<HorizonalTestAdapter.ViewHolder> {
    private lateinit var mList: MutableList<HorizonalBean>
    constructor(mList: MutableList<HorizonalBean>) : super() {
        this.mList = mList
    }

    companion object
    class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
        val tv_item = itemView.findViewById<TextView>(R.id.item)
    }


    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HorizonalTestAdapter.ViewHolder {
       val view = LayoutInflater.from(parent.context).inflate(R.layout.item_horizontal,parent,false)
        val holder = ViewHolder(view)
        holder.tv_item.setOnClickListener {
        }
        return holder
    }

    override fun getItemCount(): Int {
        return mList.size
    }

    override fun onBindViewHolder(holder: HorizonalTestAdapter.ViewHolder, position: Int) {
       holder.tv_item.text = mList[position].item
    }

}